package com.breezelin.freshmarket.entities.data;

/**
 * Created by Breeze Lin
 * 2016/9/23 17:40
 * breezesummerlin@163.com
 */

import com.breezelin.freshmarket.entities.JsonStruct;

import org.json.JSONObject;

/**
 * 用户信息
 */
public class UserInfo implements JsonStruct {

	/*
	"Body": {
    "Token": "pFGaSrI5fJ6xAQ0pdH7FElvL4nxkqO6D7nazrtSvJdmBZFE0hBTwSg32fcKaJwtnuuq39wj9YVhqAf+ifIscZEVSGiPBV4bsuvleyC8JWoA1BE7P52jUlkHSUXHbHWt+t525+w+s/f50db3AgdH6r9KlGhFTWSDn9QaYdsZHk2E=",
    "UserId": "f119641e-af6e-47e2-bc85-0b2b12b49723",
    "UserName": "13410934426",
    "Mobile": "13410934426",
    "Email": "",
    "UserLevel": "0",
    "UserLevelText": "普通用户",
    "IsActivate": "1",
    "Balance": "0.00",
    "UB": "0",
    "CouponCount": "0",
    "ActivateUrl": "",
    "DisplayName": "",
    "UserPhoto": "http://img02.yiguo.com/e/web/130101/app/userphotos/0.png",
    "PhotoTips": "http://img02.yiguo.com/e/web/130101/app/userphotos/tips.png",
    "UserLinkUrl": ""
  }
	 */

	/**
	 * 服务器回传的token
	 */
	private String token;
	/**
	 * 用户id
	 */
	private String userId;
	/**
	 * 用户的id
	 */
	private String userName;
	/**
	 * 电话
	 */
	private String mobile;
	/**
	 * 邮箱
	 */
	private String email;
	/**
	 * 用户等级
	 */
	private String userLevel;
	/**
	 * 用户等级描述
	 */
	private String userLevelText;
	/**
	 * 账户是否可用
	 */
	private String isActivate;
	/**
	 * 账户余额
	 */
	private String balance;
	/**
	 * 平台内部通货余额（优币？）
	 */
	private String ub;
	/**
	 * 优惠券数
	 */
	private String couponCount;
	/**
	 * todo 未知字段
	 */
	private String activateUrl;
	/**
	 * 显示的昵称
	 */
	private String displayName;
	/**
	 * 用户头像
	 */
	private String userPhoto;
	/**
	 * todo 位置字段
	 */
	private String photoTips;
	/**
	 * todo 未知字段
	 */
	private String userLinkUrl;

	public String getToken() {
		return token;
	}

	public String getUserId() {
		return userId;
	}

	public String getUserName() {
		return userName;
	}

	public String getMobile() {
		return mobile;
	}

	public String getEmail() {
		return email;
	}

	public String getUserLevel() {
		return userLevel;
	}

	public String getUserLevelText() {
		return userLevelText;
	}

	public String getIsActivate() {
		return isActivate;
	}

	public String getBalance() {
		return balance;
	}

	public String getUb() {
		return ub;
	}

	public String getCouponCount() {
		return couponCount;
	}

	public String getActivateUrl() {
		return activateUrl;
	}

	public String getDisplayName() {
		return displayName;
	}

	public String getUserPhoto() {
		return userPhoto;
	}

	public String getPhotoTips() {
		return photoTips;
	}

	public String getUserLinkUrl() {
		return userLinkUrl;
	}

	@Override
	public void fromJson(JSONObject jsonObject) {
		token = jsonObject.optString("Token");
		userId = jsonObject.optString("UserId");
		userName = jsonObject.optString("UserName");
		mobile = jsonObject.optString("Mobile");
		email = jsonObject.optString("Email");
		userLevel = jsonObject.optString("UserLevel");
		userLevelText = jsonObject.optString("UserLevelText");
		isActivate = jsonObject.optString("IsActivate");
		balance = jsonObject.optString("Balance");
		ub = jsonObject.optString("ub");
		couponCount = jsonObject.optString("CouponCount");
		activateUrl = jsonObject.optString("ActivateUrl");
		displayName = jsonObject.optString("DisplayName");
		userPhoto = jsonObject.optString("UserPhoto");
		photoTips = jsonObject.optString("PhotoTips");
		userLinkUrl = jsonObject.optString("UserLinkUrl");
	}

	@Override
	public JSONObject toJson() {
		return null;
	}
}
